package com.example.mam.exception;

/**
 * @author muncie [muncie.hoo@qq.com]
 */
public enum BizExceptionEnum {
    //数据库操作异常
    DB_INSERT_RESULT_ERROR(99990001, "db insert error"),
    DB_UPDATE_RESULT_ERROR(99990002, "db update error"),
    DB_DELETE_RESULT_ERROR(99990002, "db delete error"),
    DB_SELECTONE_IS_NULL(99990003, "db select return null"),

    // 用户相关异常
    INVALID_USER(10010001, "invalid user"),
    INVALID_PASSWORD(10010002, "invalid password"),
    NOT_LOGIN(10010003, "not login"),
    NO_PERMISSIONS(10010004, "no permissions"),
    INVALID_VALIDATION(10010005, "invalid validation"),
    INVALID_REFERRAL_CODE(10010006, "invalid referral code"),
    REPEAT_ERROR(10010007, "repeat error"),
    EMAIL_REPEAT_ERROR(10010008, "mail repeat error"),
    MOBILE_REPEAT_ERROR(10010009, "mobile repeat error"),
    USERNAME_REPEAT_ERROR(10010010, "username repeat error"),
    LOGIN_ERROR(10010010, "login error"),
    LOGIN_TIME_UPDATE_ERROR(10010011, "login time update error"),
    USERNAME_IS_SET(10010012, "username is set"),
    PIDS_CYCLE(10010013, "pids cycle"),





    //邮件发送异常
    INVALID_TO_ADDRESS(10020001, "invalid to address"),
    EMAIL_SPAM_ERROR(10020002, "spam email"),
    EMAIL_SEND_ERROR(10020003, "email send error"),

    // 申请业务异常
    APPLY_REPEAT(10030001, "apply repeat"),
    APPLY_DATA_ERROR(10030002, "apply data error"),
    BANK_DATA_ERROR(10030003, "bank data error"),
    REAL_INFO_EXISTED(10030004, "real info existed"),
    MT_INFO_EXISTED(10030005, "mt info existed"),
    REAL_INFO_INEXISTENCE(10030006, "real info inexistence"),
    BANK_MAX(10030007, "bank max"),
    INVALID_BANK(10030008, "invalid bank"),

    // 通知业务异常
    INFORM_ERROR(10040001, "inform erroe"),

    // 杠杆业务异常
    LEVERAGE_REPEAT(10050001, "leverage repeat"),
    INVALID_LEVERAGE(10050002, "invalid leverage"),
    USING_LEVERAGE(10050003, "using leverage"),

    // mt相关异常
    GROUP_NOT_AVAILABLE(10060001, "group not available"),
    INVALID_LOGIN(10060002, "invalid login"),


    // 出入金异常
    BEYOND_SCOPE(10070001, "beyond scope"),
    INVALID_AISLE(10070002, "invalid aisle"),

    // 系统参数设置异常
    IN_USE(10080001, "in use"),
    RANK_REPEAT(10080002, "rank repeat"),


    // 角色业务异常
    INVALID_ROLE(10090001, "invalid role"),
    INVALID_ROLE_TYPE(10090002, "invalid role type"),
    USING_ROLE(10090003, "using role"),


    // 阿里云SDK异常
    CLIENT_ERROR(10100001, "client error "),

    // 系统异常
    ENCODING_ERROR(99980004, "encoding error"),
    METHOD_ERROR(99980003, "请求方式错误"),
    JSON_ERROR(99980002, "字符转译错误"),
    INNER_ERROR(99980001, "系统错误"),


//    nMamNotDelete_ERROR(1100,"不能删除MAM账号"),
//    nMamGroupNotChange_ERROR(1101,"请解绑MAM账号后再改变组"),
//    nMamOperFail_ERROR(1102,"MAM账号操作失败，可能是输入信息错误"),
//    nMasterAlreadyBindedMFPF_ERROR(1103,"主账号已经和其他MF/PF账号绑定，请先解绑后再绑定此MF/PF账号"),
//    nEquityNot0_ERROR(1120,"绑定/解绑失败，不能有在仓单而且结余和信用必须都是0"),
//    nGroupExistMF_ERROR(1121,"组中不能有绑定主账号的MF账号存在"),
//    nGroupExistPF_ERROR(1122,"组中不能有绑定主账号的PF账号存在"),
//    nGroupExistInvestor_ERROR(1123,"组中不能有绑定主账号的投资者存在"),
//    nGroupMasterInvalid_ERROR(1124,"组中的主账号不存在或无效"),
//    nGroupMFInvalid_ERROR(1125,"组中的MF账号不存在或无效"),
//    nGroupPFInvalid_ERROR(1126,"组中的PF账号不存在或无效"),
//    nInvestorHavePosition_ERROR(1127,"绑定投资者失败，不能有在仓单"),
//    nMasterChangeFail_ERROR(1130,"修改主账号无效，不能改变MF/PF账号"),
//    nLessInitialInvestments_ERROR(1140,"投资者结余小于初始投资金额"),
//    nMamNotDealer_ERROR(1150,"MAM账号不能由Manager下单"),
//    nMasterNotBanlance_ERROR(1151,"主账号不能出入金"),
//    nMamActionNotSupport_ERROE(1152,"MAM账号不支持此货币对操作方式"),
//    nMasterNotEAOpen_ERROE(1153,"主账号不能通过EA开仓"),
//    nMasterNotEAClose_ERROE(1154,"主账号不能通过EA平仓"),
//    nMFPFNotTrade_ERROE(1155,"MF/PF账号不能进行交易"),
//    nMasterNotReverseOrder_ERROE(1156,"主账号持仓单和请求不是一个方向"),
//    nInvestorBindedMasterInvalid_ERROE(1160,"投资者绑定的主账号无效"),
//    nInvestorBanlanceMinDeposit_ERROE(1161,"投资者入金小于最小入金"),
//    nInvestorBanlanceMinWithdraw_ERROE(1162,"投资者出金小于最小出金"),
//    nNotSatisfiedInvestor_ERROE(1171,"没有满足可开仓条件的投资者"),
//    nOverInvestorMaxVolumn_ERROE(1172,"开仓手超过了所有投资者最大可开仓手"),
//    nOverMaxInvestorMaxVolumn_ERROE(1173,"开仓手数过大"),
//    nInvestorNotDirectOpen_ERROE(1181,"投资者不能直接开仓"),
//    nInvestorNotDirectClose_ERROE(1182,"投资者不能直接平仓"),
//    nInvestorNotDirectTrade_ERROE(1182,"投资者不能直接交易");

    NMAMNOTDELETE_ERROR(1100,"不能删除MAM账号"),
    NMAMGROUPNOTCHANGE_ERROR(1101,"请解绑MAM账号后再改变组"),
    NMAMOPERFAIL_ERROR(1102,"MAM账号操作失败，可能是输入信息错误"),
    NMASTERALREADYBINDEDMFPF_ERROR(1103,"主账号已经和其他MF/PF账号绑定，请先解绑后再绑定此MF/PF账号"),
    NEQUITYNOT0_ERROR(1120,"绑定/解绑失败，不能有在仓单而且结余和信用必须都是0"),
    NGROUPEXISTMF_ERROR(1121,"组中不能有绑定主账号的MF账号存在"),
    NGROUPEXISTPF_ERROR(1122,"组中不能有绑定主账号的PF账号存在"),
    NGROUPEXISTINVESTOR_ERROR(1123,"组中不能有绑定主账号的投资者存在"),
    NGROUPMASTERINVALID_ERROR(1124,"组中的主账号不存在或无效"),
    NGROUPMFINVALID_ERROR(1125,"组中的MF账号不存在或无效"),
    NGROUPPFINVALID_ERROR(1126,"组中的PF账号不存在或无效"),
    NINVESTORHAVEPOSITION_ERROR(1127,"绑定投资者失败，不能有在仓单"),
    NMASTERCHANGEFAIL_ERROR(1130,"修改主账号无效，不能改变MF/PF账号"),
    NLESSINITIALINVESTMENTS_ERROR(1140,"投资者结余小于初始投资金额"),
    NMAMNOTDEALER_ERROR(1150,"MAM账号不能由MANAGER下单"),
    NMASTERNOTBANLANCE_ERROR(1151,"主账号不能出入金"),
    NMAMACTIONNOTSUPPORT_ERROE(1152,"MAM账号不支持此货币对操作方式"),
    NMASTERNOTEAOPEN_ERROE(1153,"主账号不能通过EA开仓"),
    NMASTERNOTEACLOSE_ERROE(1154,"主账号不能通过EA平仓"),
    NMFPFNOTTRADE_ERROE(1155,"MF/PF账号不能进行交易"),
    NMASTERNOTREVERSEORDER_ERROE(1156,"主账号持仓单和请求不是一个方向"),
    NINVESTORBINDEDMASTERINVALID_ERROE(1160,"投资者绑定的主账号无效"),
    NINVESTORBANLANCEMINDEPOSIT_ERROE(1161,"投资者入金小于最小入金"),
    NINVESTORBANLANCEMINWITHDRAW_ERROE(1162,"投资者出金小于最小出金"),
    NNOTSATISFIEDINVESTOR_ERROE(1171,"没有满足可开仓条件的投资者"),
    NOVERINVESTORMAXVOLUMN_ERROE(1172,"开仓手超过了所有投资者最大可开仓手"),
    NOVERMAXINVESTORMAXVOLUMN_ERROE(1173,"开仓手数过大"),
    NINVESTORNOTDIRECTOPEN_ERROE(1181,"投资者不能直接开仓"),
    NINVESTORNOTDIRECTCLOSE_ERROE(1182,"投资者不能直接平仓"),
    NINVESTORNOTDIRECTTRADE_ERROE(1182,"投资者不能直接交易");


    private int code;
    private String message;

    @Override
    public String toString() {
        return "BizExceptionEnum{" +
                "code=" + code +
                ", message='" + message + '\'' +
                '}';
    }

    BizExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
